package bigdata.backend.monitor.warehouse;

import bigdata.backend.monitor.warehouse.entity.QualityRule;
import bigdata.backend.monitor.warehouse.service.QualityRuleService;
import bigdata.backend.task.dto.TaskNodeDto;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class TestQualityRuleServiceImpl {

    @Autowired
    QualityRuleService qualityRuleService;

    @Test
    void test01() {
        List<QualityRule> qualityRules = qualityRuleService.getEnabledQualityRules();
        System.out.println(qualityRules);
    }

    @Test
    void test02() {
        List<QualityRule> qualityRules = qualityRuleService.getEnabledQualityRules();
        List<TaskNodeDto> taskNodes = qualityRuleService.genTaskNodes(qualityRules);
        for (TaskNodeDto taskNode : taskNodes) {
            System.out.println(taskNode.getName());
            System.out.println(taskNode.getSqlScript());
        }
    }

    @Test
    void test03() throws Exception {
        qualityRuleService.submitAllTask();
    }
}
